# coding:utf-8
# author:fxh

#格雷码

def moves_ins(n,forword):
    if n == 0:
        return
    moves_ins(n-1,True)
    print("enter ",n) if forword else print("exit ",n)
    moves_ins(n-1,False)


if __name__ == '__main__':
    moves_ins(3,True)